/**
 * 系统管理  角色管理
 */
<template>
  <div>
    <!-- 面包屑导航 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>角色管理</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card class="box-card" style="width: 1180px">
    <!-- ----------------------表格--------------------------- -->
    <el-table :data="roleList" border style="width: 100%">
      <el-table-column prop="id" label="角色编号" width="180"> </el-table-column>
      <el-table-column prop="roleName" label="角色名称" width="120">
      </el-table-column>      
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-popconfirm
            title="这是一段内容确定删除吗？"           
          >
          </el-popconfirm>
          <el-button type="danger" size="mini" @click="assignPermission(scope.row.id)"
            >角色分配权限</el-button
          >
        </template>
      </el-table-column>
    </el-table>
  </el-card>

  </div>
</template>

<script>
export default {
  data() {
    return {
        roleList:[]
    };
  },
  methods: {
    assignPermission(rid){
        this.$router.push({path:"/Permission",query:{rid:rid}});
    },
    loadRoles(){
        this.$axios.get("/roles/").then((res) => {
        this.roleList = res.data.data.roleList;
      });

    }

  },
  mounted(){
    this.loadRoles();
  }
};

</script>

<style scoped>
.user-search {
  margin-top: 20px;
}
.userRole {
  width: 100%;
}
</style>

 